package com.tree.dubbo.service;

import com.tree.dubbo.api.DemoService;
//import org.apache.dubbo.rpc.RpcContext;
import org.springframework.stereotype.Service;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @ClassName com.tree.dubbo.service
 * Description: <类功能描述>. <br>
 * <p>
 * <使用说明>
 * </p>
 * @Author tree
 * @Date 2019-08-25 17:03
 * @Version 1.0
 */
@Service("demoService")
public class DemoServiceImpl implements DemoService {
    public String sayHello(String name) {
        String remoteAddr = "";//RpcContext.getContext().getRemoteAddress();
        System.out.println("[" + new SimpleDateFormat("HH:mm:ss").format(new Date()) + "] Hello " + name + ", request from consumer: " + remoteAddr);
        return "Hello " + name + ", response form provider: " + remoteAddr;
    }
}
